<?php
class Australian_View_Helper_CmsEditor extends Zend_View_Helper_Abstract{
	public function cmsEditor($name, $value, $options = null, $width = '100%', $height = '350'){
		// 1. Nhung tap tin fckeditor vao file chay
		require_once (SCRIPTS_PATH . "fckeditor/fckeditor_php5.php");
		
		// 2. Khai bao duong dan URL den thu muc fckeditor
		$sBasePath = SCRIPTS_URL . '/fckeditor/';
		
		// 3. Khoi tao doi tuong fckeditor
		$oFCKeditor = new FCKeditor($name) ;
		
		// 4. Thiet lap duong dan cho thuoc tinh basePath
		$oFCKeditor->BasePath = $sBasePath;
		
		// 5. Dua gia tri vao fckeditor
		$oFCKeditor->Value = $value;
		
		// 6. Thay doi kich thuoc cua fckeditor
		$oFCKeditor->Width = $width; // '100%'
		$oFCKeditor->Height = $height;
		if(!isset($options['toolbar'])){
			$oFCKeditor->ToolbarSet = 'Default';
		}else{
			$oFCKeditor->ToolbarSet = $options['toolbar'];
		}
		
		if(!isset($options['language'])){
			$oFCKeditor->Config['AutoDetectLanguage'] = false;
			$oFCKeditor->Config['DefaultLanguage'] = 'en';
		}else{
			$oFCKeditor->Config['AutoDetectLanguage'] = false;
			$oFCKeditor->Config['DefaultLanguage'] = $options['language'];
		}
		
		// 8. Tao fckeditor
		return $oFCKeditor->Create() ;
	}
}